<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="footer">
<body>
<footer class="footer bg-white">
    <div class="footer-social">
        <div class="footer-container clearfix">
            <div class="social-list">
                <th:block th:each="index:${commons.social()}">
                    <th:block th:if="${index.value}!=null and ${index.value}!=''">
                        <th:block th:switch="${index.key}">

                            <th:block th:case="'weibo'">
                                <a class="social weibo" target="_blank" th:href="${index.value}">微博</a>
                            </th:block>

                            <th:block th:case="'zhihu'">
                                <a class="social zhihu" target="_blank" th:href="${index.value}">知乎</a>
                            </th:block>

                            <th:block th:case="'github'">
                                <a class="social github" target="_blank" th:href="${index.value}">Github</a>
                            </th:block>

                            <th:block th:case="'mayun'">
                                <a class="social twitter" target="_blank" th:href="${index.value}">码云</a>
                            </th:block>

                        </th:block>
                    </th:block>
                </th:block>
            </div>
        </div>
    </div>
    <div class="footer-meta">
        <div class="footer-container">

            <div class="meta-item meta-copyright">
                <div class="meta-copyright-info">
                    <a href="https://gitee.com/beijinglogic" target="_blank" class="info-logo">
                        <img th:src="@{/user/img/logo.png}" th:alt="${commons.site_title()}"/>
                    </a>
                    <div class="info-text">
                        <p>农码一生为了谁</p>
                        <p>我曾七次鄙视自己的灵魂：</p>
                        <p>第一次,当它空虚时，用爱欲来填充；</p>
                        <p>第二次,当它本可进取时，却故作谦卑；</p>
                        <p>第三次,当在困难和容易之间，它选择了容易；</p>
                        <p>第四次,当它自由软弱，却把它认为是生命的坚韧；</p>
                        <p>第五次,当它犯了错，却借由别人也会犯错来宽慰自己；</p>
                        <p>第六次,当它侧身于生活的污泥中虽不甘心，却又畏首畏；</p>
                        <p>第七次,当它鄙夷一张丑恶的嘴脸时，却不知那正是自己面具中的一副。</p>
                        <!--<p>Powered By <a th:href="@{https://gitee.com/beijinglogic}" target="_blank" rel="nofollow">70KG</a>-->
                        <!--</p>-->
                        <!--<p>&copy; 2018 版权所有 <a th:href="@{/}">MyStory</a></p>-->
                        <!--<p>本站总访问次数:<a th:text="${commons.getVisitCount()}+'次'"></a></p>-->
                        <!--<th:block th:if="${option}!=null and ${option.getValue()}!=''">-->
                            <!--<a href="http://www.miitbeian.gov.cn" target="_blank" style="cursor: pointer" th:text="${option.getValue()}"></a>-->
                        <!--</th:block>-->
                    </div>
                    <!--<div id="zzsc"><canvas id="canvas" width="250" height="60"></canvas></div>-->
                    <!--<script>-->
                        <!--function IsPC() {-->
                            <!--var userAgentInfo = navigator.userAgent;-->
                            <!--var Agents = ["Android", "iPhone",-->
                                <!--"SymbianOS", "Windows Phone",-->
                                <!--"iPad", "iPod"];-->
                            <!--var flag = true;-->
                            <!--for (var v = 0; v < Agents.length; v++) {-->
                                <!--if (userAgentInfo.indexOf(Agents[v]) > 0) {-->
                                    <!--flag = false;-->
                                    <!--break;-->
                                <!--}-->
                            <!--}-->
                            <!--return flag;-->
                        <!--}-->

                        <!--var flag = IsPC(); //true为PC端，false为手机端-->
                        <!--if(flag){-->
                            <!--$.getScript("https://cdn-1251747095.file.myqcloud.com/static/js/zzsc.js", function(){})-->
                        <!--}else {-->
                            <!--$("#zzsc").hide();-->
                        <!--}-->
                    <!--</script>-->
                </div>
            </div>

            <!--<div class="meta-item meta-posts">-->
                <!--<h3 class="meta-title">最新文章</h3>-->
                <!--<th:block th:each="content:${commons.getContents()}">-->
                    <!--<li>-->
                        <!--<a th:href="${commons.permalink(content)}" target="_blank" th:text="${content.title}"></a>-->
                    <!--</li>-->
                <!--</th:block>-->
            <!--</div>-->

            <div class="meta-item meta-comments">
                <h3 class="meta-title">最新评论</h3>
                <th:block th:each="comment:${commons.getComments()}">
                    <li>
                        <a th:href="${commons.site_url('/article/')}+${comment.cid}+'/1'+'#comment-'+${comment.coid}" target="_blank" th:text="${comment.author}+'：'+${comment.content}"></a>
                    </li>
                </th:block>
            </div>

        </div>

    </div>

    <!-- 备案信息展示 -->
    <div style="width:300px;margin:0 auto; padding:10px 0;">
        <a target="_blank" href="http://www.miitbeian.gov.cn" style="text-align: center;color:#939393;margin-left:18%;" th:text="${option.getValue()}"></a></br>
        <a target="_blank" href="https://gitee.com/beijinglogic" style="text-align: center;color:#939393;margin-left:20%;">Powered By 70KG</a></br>
        <a target="_blank" href="https://gitee.com/beijinglogic" style="text-align: center;color:#939393;margin-left:15%;" th:text="'本站总访问次数：'+${commons.getVisitCount()}+'次'"></a></br>
        <a target="_blank" href="http://www.nmyswls.com" style="text-align: center;color:#939393;margin-left:6%;" th:text="'&copy; '+${commons.site_option('site_copyright')}"></a>
        <!--<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=" style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="" style="float:left;"><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;">鄂公网安备 42011502000211号</p></a>-->
    </div>

</footer>

<th:block th:if="${is_post}">
    <div id="directory-content" class="directory-content">
        <div id="directory"></div>
    </div>
    <script>
        /*<![CDATA[*/
        var postDirectoryBuild = function () {
            var postChildren = function children(childNodes, reg) {
                    var result = [],
                        isReg = typeof reg === 'object',
                        isStr = typeof reg === 'string',
                        node, i, len;
                    for (i = 0, len = childNodes.length; i < len; i++) {
                        node = childNodes[i];
                        if ((node.nodeType === 1 || node.nodeType === 9) &&
                            (!reg ||
                                isReg && reg.test(node.tagName.toLowerCase()) ||
                                isStr && node.tagName.toLowerCase() === reg)) {
                            result.push(node);
                        }
                    }
                    return result;
                },
                createPostDirectory = function (article, directory, isDirNum) {
                    var contentArr = [],
                        titleId = [],
                        levelArr, root, level,
                        currentList, list, li, link, i, len;
                    levelArr = (function (article, contentArr, titleId) {
                        var titleElem = postChildren(article.childNodes, /^h\d$/),
                            levelArr = [],
                            lastNum = 1,
                            lastRevNum = 1,
                            count = 0,
                            guid = 1,
                            id = 'directory' + (Math.random() + '').replace(/\D/, ''),
                            lastRevNum, num, elem;
                        while (titleElem.length) {
                            elem = titleElem.shift();
                            contentArr.push(elem.innerHTML);
                            num = +elem.tagName.match(/\d/)[0];
                            if (num > lastNum) {
                                levelArr.push(1);
                                lastRevNum += 1;
                            } else if (num === lastRevNum ||
                                num > lastRevNum && num <= lastNum) {
                                levelArr.push(0);
                                lastRevNum = lastRevNum;
                            } else if (num < lastRevNum) {
                                levelArr.push(num - lastRevNum);
                                lastRevNum = num;
                            }
                            count += levelArr[levelArr.length - 1];
                            lastNum = num;
                            elem.id = elem.id || (id + guid++);
                            titleId.push(elem.id);
                        }
                        if (count !== 0 && levelArr[0] === 1) levelArr[0] = 0;

                        return levelArr;
                    })(article, contentArr, titleId);
                    currentList = root = document.createElement('ul');
                    dirNum = [0];
                    for (i = 0, len = levelArr.length; i < len; i++) {
                        level = levelArr[i];
                        if (level === 1) {
                            list = document.createElement('ul');
                            if (!currentList.lastElementChild) {
                                currentList.appendChild(document.createElement('li'));
                            }
                            currentList.lastElementChild.appendChild(list);
                            currentList = list;
                            dirNum.push(0);
                        } else if (level < 0) {
                            level *= 2;
                            while (level++) {
                                if (level % 2) dirNum.pop();
                                currentList = currentList.parentNode;
                            }
                        }
                        dirNum[dirNum.length - 1]++;
                        li = document.createElement('li');
                        link = document.createElement('a');
                        link.href = '#' + titleId[i];
                        link.innerHTML = !isDirNum ? contentArr[i] :
                            dirNum.join('.') + ' ' + contentArr[i];
                        li.appendChild(link);
                        currentList.appendChild(li);
                    }
                    directory.appendChild(root);
                };
            createPostDirectory(document.getElementById('post-content'), document.getElementById('directory'), true);
        };
        postDirectoryBuild();
        /*]]>*/
    </script>

</th:block>

<script th:src="@{/user/js/headroom.min.js}"></script>
<script th:src="@{/user/js/highlight.min.js}"></script>
<script th:src="@{/user/js/instantclick.min.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var isOk = [[${is_post}]];
    if (isOk) {
        var postDirectory = new Headroom(document.getElementById("directory-content"), {
            tolerance: 0,
            offset: 100,
            classes: {
                initial: "initial",
                pinned: "pinned",
                unpinned: "unpinned"
            }
        });
    }


    var header = new Headroom(document.getElementById("header"), {
        tolerance: 10,
        offset: 80,
        classes: {
            initial: "animated",
            pinned: "slideDown",
            unpinned: "slideUp"
        }
    });
    header.init();
    $('#search-inp').keypress(function (e) {
        var key = e.which; //e.which是按键的值
        if (key == 13) {
            var q = $(this).val();
            if (q && q != '') {
                window.location.href = '/search/' + q;
            }
        }
    });
    /*]]>*/
</script>
<script data-no-instant="">
    /*<![CDATA[*/
    InstantClick.on('change', function (isInitialLoad) {
        var blocks = document.querySelectorAll('pre code');
        for (var i = 0; i < blocks.length; i++) {
            hljs.highlightBlock(blocks[i]);
        }
        if (isInitialLoad === false) {
            if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
        }
    });
    InstantClick.init('mousedown');
    /*]]>*/
</script>
</body>
</html>